import { attackRoles } from "utils/constants/bodyconstant";
import { FormationPattern } from "../FormationPattern";
import { SlotAssignment, Static } from "../types";

export class Team2Pattern<T extends Charactor> extends FormationPattern<T>
{
    public getRotateIndex(): false | number[] 
    {
        return false
    }
    public getSlotCount(): number {
        return this._slotLocation.length;
    }

  
    // 默认朝向 +X ------>
    /**
     *
     *  heal  attack
     *
    */
    private _slotLocation:IFVector2[]=[{x:0,y:0},{x:1,y:0}];
    private offset:IFVector2={x:0,y:0.5};
    public   getDriftOffset(slotAssignments:SlotAssignment<T>[]):Static
    {
        return new Static();
    }
    public getOffset(): IFVector2 {
        return this.offset
    }
    public getDirection(): IFVector2 {
        return {x:-1,y:0}
    }
    // 获取槽 在队形中的相对位置
    public   getSlotLocation(slotNumber:number):IFVector2
    {
        return this._slotLocation[slotNumber];
    }
    public   getSlotLocations( ):Readonly<IFVector2>[]
    {
        return this._slotLocation
    }


    // 如果该图案能支持给定的数量的槽位，则返回true
    public   supportSlots(slotCount:number):boolean
    {
        return slotCount<=this._slotLocation.length;
    }

    public getSlotCost(slot:SlotAssignment<T>):number{
        if(attackRoles.has( slot.charactor.ActiveRole() ) && slot.slotNumber ==0)
        {
            return 100;
        }
        if(slot.charactor.ActiveRole() == "idaHeal" && slot.slotNumber ==1)
        {
            return 100;
        }
        return 0
    }
}
